<template>
  <sg-submenu :name="node.name" v-if="node.children && node.children.length > 0">
    <template slot="title">
      <span>{{ node.name }}</span>
    </template>
    <sg-tree-menu v-for="child in node.children" :key="child.name" :node="child" />
  </sg-submenu>
  <sg-menu-item :name="node.cmd" v-else>
    <span slot="title">{{ node.name }}</span>
  </sg-menu-item>
</template>

<script>
  export default {
    name: 'sg-tree-menu',
    props: {
      node: {
        type: Object
      }
    }
  };
</script>
